﻿// Developer Express Code Central Example:
// World Wide CRM Demo
// 
// The World Wide CRM demo is a next generation application with outstanding
// navigation capabilities and shows a reimagined view of customer contact and
// management. This demo showcases many of the most popular features of the
// WinForms Subscription.
// 
// You can find sample updates and versions for different programming languages here:
// http://www.devexpress.com/example=E3993

using System.Drawing;

namespace DevExpress.CrmDemo.Win.Helpers
{
    public static class FormsExtensions
    {
        public static Bitmap CropBitmap(this Bitmap bitmap, Rectangle rectangle)
        {
            var croppedBitmap = new Bitmap(rectangle.Width, rectangle.Height);
            var graphics = Graphics.FromImage(croppedBitmap);
            graphics.DrawImage(bitmap, 0, 0, rectangle, GraphicsUnit.Pixel);
            return croppedBitmap;
        }

        public static Point Add(this Point point1, Point point2)
        {
            return Point.Add(point1, new Size(point2));
        }
    }
}